package com.ruibang.glass.produce.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruibang.glass.produce.domain.req.WorkshopReq;
import com.ruibang.glass.produce.entity.Workshop;
import com.ruibang.glass.produce.mapper.WorkshopMapper;
import com.ruibang.glass.produce.service.WorkshopService;
import org.apache.tomcat.jni.FileInfo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2023-11-15  18:57
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class WorkshopServiceImpl extends ServiceImpl<WorkshopMapper, Workshop> implements WorkshopService {

    @Override
    public Page<Workshop> queryWorkshop(WorkshopReq workshopReq) {
        LambdaQueryWrapper<Workshop> wsLqw = new LambdaQueryWrapper<>();
        if (StringUtils.isNotBlank(workshopReq.getWorkshopName())) {
            wsLqw.like(Workshop::getWorkshopName, "%" + workshopReq.getWorkshopName() + "%");
        }
        return baseMapper.selectPage(new Page<>(workshopReq.getPageNo(), workshopReq.getPageSize()), wsLqw);
    }
}
